package com.hqyj.controller;


import com.hqyj.dao.JobMapper;
import com.hqyj.pojo.Employee;
import com.hqyj.pojo.Job;
import com.hqyj.service.JobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.awt.event.ItemEvent;
import java.util.HashMap;

@Controller
@RequestMapping("/job")
public class jobController {

    @Autowired
    JobService jobservice;

    //访问职位列表
    @RequestMapping("/listJob")
    public String listJob() {
        return "jobList";
    }

    //所有职位
    @RequestMapping("/allJob")
    @ResponseBody
    public HashMap<String, Object> selectAllJob() {
        HashMap<String, Object> map = jobservice.selectAllJob();
        for (Object value : map.values()) {
            System.err.println(value);
        }
        return map;
    }

    //添加职位
    @RequestMapping("/addJobPage")
    public String addPage() {
        return "addJob";
    }

    @RequestMapping("/addJob")
    @ResponseBody
    public HashMap<String, Object> addJob(Job job) {

        return  jobservice.addJob(job);
    }

    //删除职位
    @RequestMapping("/deleteBysId")
    @ResponseBody
    public HashMap<String, Object> deleteJob(int id) {

        return  jobservice.deleteBysId(id);
    }
}

